package edu.corn.statemachine.core.builder;

import java.util.ArrayList;

public abstract class AbstractStateMachineBuilder<S extends Enum<S>, E extends Enum<E>> implements IStateMachineBuilder<S, E> {
    protected final ArrayList<Trigger<S, E>> triggerBuilders = new ArrayList<>();

    private Trigger.Builder<S, E> triggerTemp;

    @Override
    public Trigger.Builder<S, E> with() {
        triggerTemp = new Trigger.Builder<>(this);
        return triggerTemp;
    }

    @Override
    public AbstractStateMachineBuilder<S, E> and() {
        triggerBuilders.add(triggerTemp.build());
        triggerTemp = new Trigger.Builder<>(this);
        return this;
    }

}
